package cn.ly.net.tcp;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.ServerSocket;
import java.net.Socket;

public class KeyServer {
	
	public static void main(String[] args) throws IOException, InterruptedException {
		ServerSocket ss = new ServerSocket(22222);
		
		Socket s = ss.accept();
		
		BufferedReader br = new BufferedReader(new InputStreamReader(s.getInputStream()));
		String line = null;
		while( (line = br.readLine()) != null){
			System.out.println(line);
		}
		BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(s.getOutputStream()));
		bw.write("收到");
		bw.flush();
		Thread.sleep(1000<<2);
		bw.close();
		s.close();
	}

}
